<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<%
Connection conn=null;
Statement stmt=null;
try{
	Class.forName("com.mysql.jdbc.Driver");
}
catch(ClassNotFoundException e){
	System.out.print("la classe est introuvale");
	e.printStackTrace();
	}
try{
	String url="jdbc:mysql://localhost:3306/base_labrocante";
	String user="root";
	String pw="";
	conn=DriverManager.getConnection(url,user,pw);
	String idAnnonce = request.getParameter("idannonce");
	String titre=request.getParameter("titre");
	String texteAnnonce=request.getParameter("texteAnnonce");
	String tel= request.getParameter("tel");
	String prix = request.getParameter("prix");
	String ville=request.getParameter("ville");
	String categorie=request.getParameter("categorie");
	stmt = conn.createStatement();
	String req1="UPDATE annonce SET titre='"+titre+"', texteAnnonce='"+texteAnnonce+"', tel='"+tel+"', prix='"+prix+"', ville='"+ville+"', categorie='"+categorie+"'  WHERE idAnnonce=?";
	PreparedStatement ps = conn.prepareStatement(req1);
	ps.setString(1, idAnnonce);
	ps.executeUpdate();
	response.sendRedirect("allAnnonce.jsp");
%>

<%
}
catch(SQLException e){
e.printStackTrace();
}
%>
</body>
</html>